import request from '@/utils/request'
// 获取分类列表
export function getCategoryList(params) {
  return request({
    url: '/categories?',
    params
  })
}
// 根据id获取数据
export function getDetail(id) {
  return request({
    url: `/categories/${id}`
  })
}

// 新增
export function addCategoty(data) {
  return request({
    url: '/categories',
    method: 'post',
    data
  })
}

// 编辑
export function editCategory(data) {
  return request({
    url: `/categories/${data.id}`,
    method: 'put',
    data
  })
}

// 删除
export function delCategory(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'
  })
}

// 获取分类数量
export function getSearchCount(params) {
  return request({
    url: `/categories/count?title_contains=${params}`
  })
}

